<%@ page language="java" import="java.util.*"%>
<%@ page language="java" import="com.hospital.model.*"%>
<%@ page import="com.hospital.util.DbUtil"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title></title>
<link href="images/main.css" rel="stylesheet" type="text/css" />
<link href="../css/style.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="../js/trim.js"></script>
<script language="javascript" type="text/javascript"
	src="../My97DatePicker/WdatePicker.js"></script>
<script type="text/javascript">
	function sub() {
		document.forms["form"].submit();
	}
	function Change_Select() {
		var patientId = document.getElementById("patientId").value;
		alter("");
	}
</script>
</head>
<body onload="init();">
	<jsp:include page="right_top.jsp"></jsp:include>
	<!-- TOP START -->
	<div id="right_font">
		<img src="images/main_14.gif" /> 您现在所在的位置：首页 → 住院信息管理 → <span
			class="bfont">添加住院信息</span>
	</div>
	<!-- TOP END -->
	<hr>
	<form action="PatientInhospitableServlet?method=add" method="post"
		name="form" id="form">
		<%
			UserInfo doctor = (UserInfo) (session.getAttribute("userInfo"));
			int id = doctor.getId();
			String sql_nurse = "select * from t_user_info where id = " + id;
			Map<String, Object> map_nurse = (Map<String, Object>) DbUtil.find(
					sql_nurse).get(0);
		%>
		<%
			String sickbedId = request.getParameter("sickbedId");
		%>
		<table style="margin-top: 30px;">
			<tr height="30px;">
				<td colspan="2" align="center">&nbsp;<input type="hidden"
					name="nurse_name" value="<%=map_nurse.get("account")%>" /></td>
				<td>&nbsp;</td>
			</tr>
			<tr height="30px;">
				<td><font color="#ff0000">*</font>病床编号：</td>
				<td><%=sickbedId%></td>
				<td>&nbsp;</td>
			</tr>
			<tr height="30px;">
				<td><font color="#FF0000">*</font>病患姓名：</td>
				<td><select name="patientId" id="patientId">
						<%
							//添加进入病房Id号码
							String sql = "select * from t_patient_info where Inhospitable = 'yes' and sickbedId = 'null'";
							List<Map<String, Object>> list = DbUtil.find(sql);
							Map<String, Object> map = null;
							if (list.size() != 0) {
								for (int i = 0; i < list.size(); i++) {
									map = (Map<String, Object>) list.get(i);
						%>
						<option value="<%=map.get("id")%>"><%=map.get("account")%>
						</option>
						<%
							}
						%>
						<tr height="30px;">
							<td><font color="#FF0000">*</font>病人所属科室：</td>
							<td><select name="deptname" id="deptname">
									<%
										//添加进入科室号码
											String sqldept = "select * from t_department where type = '科室'";
											List<Map<String, Object>> listdept = DbUtil.find(sqldept);
											Map<String, Object> mapdept = null;
											for (int i = 0; i < listdept.size(); i++) {
												mapdept = (Map<String, Object>) listdept.get(i);
									%>
									<option value="<%=mapdept.get("name")%>"><%=mapdept.get("name")%></option>
									<%
										}
									%>
							</select></td>
							<td>&nbsp;</td>
						</tr>
						<tr height="30px;">
							<td><font color="#FF0000">*</font>状&nbsp;&nbsp;态：</td>
							<td><select name="state" id="state">
									<option value="正在使用">投入使用</option>
							</select></td>
							<td>&nbsp;</td>
						</tr>
						<tr height="30px;">
							<td><font color="#FF0000">*</font>病床价格：</td>
							<td><select name="salemoney" id="salemoney">
									<option value="100">100元/天</option>
									<option value="200">200元/天</option>
									<option value="300">300元/天</option>
									<option value="400">400元/天</option>
							</select></td>
							<td>&nbsp;</td>
						</tr>
						<tr height="30px;">
							<td colspan="2" align="center">&nbsp;<input type="hidden"
								name="sickbedid" value="<%=sickbedId%>" /></td>
							<td>&nbsp;</td>
						</tr>

						<tr height="30px;">
							<td colspan="2" align="center"><input type="button"
								value="办理入院" onclick="sub();" />&nbsp;&nbsp; <input
								type="button" value="返回" onclick="history.go(-1);" /></td>
							<td>&nbsp;</td>
						</tr>
		</table>
	</form>
	<%
		} else {
	%>
	<option value="">无需要住院病人</option>
	</select>
	</td>
	<td>&nbsp;</td>
	</tr>
	<tr height="30px;">
							<td colspan="2" align="center"> 
							<input type="button" value="返回" onclick="history.go(-1);" /></td>
							<td>&nbsp;</td>
						</tr>
	</table>
	</form>
	<%
		}
	%>
</body>
</html>